public class Test {
    public static void main(String[] args) {
        Tree.TreeNode root = new Tree.TreeNode(1);
        Tree.TreeNode root1 = new Tree.TreeNode(3);
        Tree.TreeNode root2 = new Tree.TreeNode(4);
        Tree.TreeNode root3 = new Tree.TreeNode(2);
        Tree.TreeNode root4 = new Tree.TreeNode(8);
        Tree.TreeNode root5 = new Tree.TreeNode(7);
        root.left = root1;
        root.right = root2;
        root1.left = root3;
        root1.right = root5;
        root2.right = root4;
        Tree tree = new Tree();
        Tree.TreeNode ret = tree.lowestCommonAncestor(root,root3 ,root5 );
        System.out.println(ret.val);
    }
}
